package nl.windgazer.arachne.services.facebook;

import java.util.HashMap;

import org.apache.tapestry5.MarkupWriter;
import org.apache.tapestry5.services.Environment;
import org.apache.tapestry5.services.javascript.InitializationPriority;

public interface FacebookAPISettings {

	public static final String API = "arachne.facebook.api";
	public static final String APP = "arachne.facebook.app";
	public static final String APP_SECRET = "arachne.facebook.app.secret";
	public static final String APP_SCOPE = "arachne.facebook.app.scope";
	public static final String XFBML_DEFAULT = "arachne.facebook.defaults.xfbml";
	public static final String COOKIE_DEFAULT = "arachne.facebook.defaults.cookie";
	public static final String STATUS_DEFAULT = "arachne.facebook.defaults.status";
	public static final String ENABLE_SERVICE = "arachne.facebook.service.enabled";
	public static final String RELOAD_ON_SESSIONCHANGE_DEFAULT = "arachne.facebook.sessionchange.reload";

	public static final String API_NULL = "null";
	public static final String APP_NULL = API_NULL;
	public static final String APP_SCOPE_DEFAULT = "email user_hometown";
	public static final String APP_SECRET_NULL = API_NULL;
	public static final String XFBML_DEFAULT_DEFAULT = Boolean.TRUE.toString();
	public static final String COOKIE_DEFAULT_DEFAULT = Boolean.TRUE.toString();
	public static final String STATUS_DEFAULT_DEFAULT = Boolean.TRUE.toString();

	public static final String JS_XFBML_FIX = "classpath:/de/ka-mediendesign/span2xfbml.js";
	public static final String ENABLE_FACEBOOK_PRIVILEGES = "arachne.facebook.privileges";

	public void setRender(boolean render);
	public boolean getRender();

	/**
	 * Determine if cookie needs to be initialised.
	 * Factory default is true
	 * 
	 * @param cookie
	 */
	public void setCookie(boolean cookie);

	/**
	 * Determine if initalisation must include information regarding user status.
	 * Factory default is true
	 * 
	 * @param status
	 */
	public void setStatus(boolean status);

	/**
	 * Determine if during initialisation the XFBML code needs to be loaded as well.
	 * Factory default is true
	 * 
	 * @param xfbml
	 */
	public void setXFBML(boolean xfbml);

	/**
	 * Add an extra initialisation script, for instance if you want to parse fbxml,
	 * although in that case the setXFBMLParse() convenience method is recommended...
	 * 
	 * @param init
	 */
	public void addInit(String init, InitializationPriority priority);

	public void setXFBMLParse(final String id, final String tag, String ... params);
	
	public void render(MarkupWriter writer, Environment _environment);

	/**
	 * Force page reload when session cookie changes. This is useful for detecting login, etc. This setting may
	 * cause infinite reload loops when used on pages with social plugins :(
	 * 
	 * @param reload
	 */
	public void setSessionReload(boolean reload);

	public HashMap<String, String> getSettings();

	/**
	 * Check to see if the currently logged in user-credentials exist and can be verified.
	 * @return
	 */
	public boolean isVerified();

	/**
	 * Clear any existing fbs_ cookies from the response, in hopes of cleaning up any oAuth left-overs...
	 */
	public void clearFBCookies();

}
